package com.zzl.bonds.ticket.feign;

import com.zzl.apidoc.annotation.ApidocOperation;
import com.zzl.apidoc.annotation.ApidocParam;
import com.zzl.bonds.ticket.dto.feign.ContractGeneratorDto;
import com.zzl.bonds.ticket.dto.feign.TicketContractAddDto;
import com.zzl.bonds.ticket.dto.feign.TicketContractListDto;
import com.zzl.bonds.ticket.entity.feign.ContractEntity;
import com.zzl.general.common.apidoc.annotation.ApidocReturnPage;
import com.zzl.general.common.apidoc.annotation.ApidocReturnR;
import com.zzl.general.common.feign.config.FeignClientsConfig;
import com.zzl.general.common.utils.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * 合同中心的feign接口
 */
@FeignClient(value = "contract", configuration = FeignClientsConfig.class)
public interface ContractFeign {

    /**
     * 绑定票据和签署资料关系
     */

    @PostMapping("/contract/feign/saveTicketContract")
    @ApidocOperation(description = "创建即将签约合同，不发送cfca", operationId = "contract/contract/saveContract")
    @ApidocReturnR
    List<ContractEntity> saveTicketContract(@ApidocParam(description = "保存的合同对象值", name = "{contract}", required = true) @RequestBody @Validated TicketContractAddDto contract);

    /**
     * 列表
     */
    @PostMapping("/contract/feign/ticketContractList")
    @ApidocOperation(description = "查询签署资料列表", operationId = "contract/contract" + "/contractList")
    @ApidocReturnPage(genericTypeClass = ContractEntity.class)
    List<ContractEntity> ticketContractList(@ApidocParam(description = "查询条件", name = "ticketContractListDto", required = true) @RequestBody @Validated TicketContractListDto ticketContractListDto);

    /**
     * 保存
     */
    @PostMapping("/contract/feign/generateContract")
    @ApidocOperation(description = "生成电子合同", operationId = "contract/contract/generateContract")
    @ApidocReturnR
    Result generateContract(@RequestBody @Validated ContractGeneratorDto contract);
}
